<!-- #layout name=blank-->
<div class="page-header">
    <h1 class="title">Code</h1>
</div>
<div data-bind="component: { name: 'kb-breadcrumb', params:[{
    name: 'SITES'
},{
    name: 'DASHBOARD'
},{
    name: Kooboo.text.common.Code
}]}"></div>
<div class="navbar navbar-default">
    <div class="container-fluid">
        <a data-bind="attr: { href: codeCreateUrl }, text: createBtnText, visible: curType() !== 'all'" class="btn green navbar-btn"></a>
        <div class="btn-group navbar-btn" data-bind="visible: curType() == 'all'">
            <button class="btn green dropdown-toggle" type="button" data-toggle="dropdown"><span>Create</span> <i class="fa fa-angle-down"></i></button>
            <ul class="dropdown-menu" role="menu" data-bind="foreach: codeTypes">
                <!-- ko if: $data.editUrl -->
                <li>
                    <a data-bind="text: $data.displayName, attr: { href: $data.editUrl }"></a>
                </li>
                <!-- /ko -->
            </ul>
        </div>
        <a data-bind="visible: ['api','all'].indexOf(curType()) > -1, click: onShowApiModal" class="btn navbar-btn green">API Generator</a>
        <a data-bind="visible: showDeleteBtn, click: onDelete" class="btn red navbar-btn">Delete</a>
    </div>
</div>
<ul data-bind="foreach: codeTypes" class="nav nav-tabs">
    <li data-bind="css: { 'active': $parent.curType() == $data.value }, click: $parent.changeCodeType.bind(this, $data.value)">
        <a href="javascript:;" data-bind="text: $data.displayName"></a>
    </li>
</ul>
<div data-bind="component: { name: 'kb-table', params: tableData }"></div>
<div data-bind="component: { name: 'kb-relation-modal' }"></div>
<kb-api-generation-modal params='isShow: showAPIGenerationModal'></kb-api-generation-modal>
<script>
    (function() {
        Kooboo.loadJS([
            "/_Admin/Scripts/kooboo/Guid.js",
            "/_Admin/Scripts/components/kbTable.js",
            "/_Admin/Scripts/components/kbBreadcrumb.js",
            "/_Admin/Scripts/tableModel.js",
            "/_Admin/Scripts/components/kbRelationModal.js",
            "/_Admin/Scripts/components/kbAPIGenerationModal.js",
        ]);
    })()
</script>
<script src="/_Admin/View/Development/Code.js"></script>